class cat:
    def set_name(self):
        self.name = "tom"  # 定了了一个属性,名叫name,值是tom

    def eat(self):
        print("%s吃饭" % self.name)

    def drink(self):
        print("%s喝水" % self.name)


c = cat()
c.drink()
c.eat()


c.name ="张三"
c.eat()
c.drink()